/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package group6renderer;
import group6renderer.renderernode.*;
import group6renderer.renderernode.*;
import java.util.HashMap;

/**
 *
 * @author Yiannis
 */
public class HTMLConstants {
    
    private static HashMap<String, TreeNode> constants;
    public static final String BOLD = "b";
    public static final String ITALIC = "i";
    public static final String UNDERLINE = "u";
    public static final String WRAPPED = "w";
    public static final String BLOCKQUOTE = "blockquote";
    public static final String PRE = "pre";
    public static final String CENTER = "center";
    public static final String RIGHT = "right";
    public static final String LEFT = "left";
    public static final String HTML = "html";
    public static final String HEAD = "head";
    public static final String TITLE = "title";
    public static final String BODY = "body";
    public static final String HEADING1 = "h1";
    public static final String HEADING2 = "h2";
    public static final String HEADING3 = "h3";
    public static final String HEADING4 = "h4";
    public static final String HEADING5 = "h5";
    public static final String HEADING6 = "h6";
    public static final String HEADING7 = "h7";
   
    public static final String ORDLIST = "ol";
    public static final String UNORDLIST ="ul";
    public static final String LISTINDEX ="li";
    
      
    public static final int LEVELS_OF_HEADINGS =7;
    
    public static void buildHTMLConstants()
    {
	constants = new HashMap<String, TreeNode>();
	
	constants.put(HTML, new HtmlNode());
	constants.put(HEAD, new HeadNode());
	constants.put(TITLE, new TitleNode());
	constants.put(BODY, new BodyNode());
	
	
	constants.put(BOLD, new BoldNode());
	constants.put(ITALIC, new ItalicNode());
	constants.put(UNDERLINE, new UnderLineNode());
	constants.put(BLOCKQUOTE, new BlockQuoteNode());
	constants.put(PRE, new PreNode());
	
	constants.put(CENTER, new AlignmentNode(CENTER));
	constants.put(RIGHT, new AlignmentNode(RIGHT));
	constants.put(LEFT, new AlignmentNode(LEFT));
	
	constants.put(HEADING1, new HeadingNode(HEADING1));
	constants.put(HEADING2, new HeadingNode(HEADING2));
	constants.put(HEADING3, new HeadingNode(HEADING3));
	constants.put(HEADING4, new HeadingNode(HEADING4));
	constants.put(HEADING5, new HeadingNode(HEADING5));
	constants.put(HEADING6, new HeadingNode(HEADING6));
	constants.put(HEADING7, new HeadingNode(HEADING7));
	
    }
    
    public static boolean isOpeningTag(String tag)
    {
	return tag.contains("/");
    }
    
    public static TreeNode getInstance(String tag)throws Exception
    {
	TreeNode node= constants.get(tag).copy();
	System.out.println(node.getName());
	if (node == null) {
		throw new Exception("tag not found");
	}
		return node;
	}

}
